﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DebugTools
{
    class PM_ZLG310:PowerMeter
    {
        public PM_ZLG310(string szInsID):base(szInsID)
        {
            _szType = "ZLG,PA310";
        }

        public override bool Init()
        {
            this._ListInitCmd.Add("*RST\n");
            this._ListInitCmd.Add(":COMM:REM ON\n");
            this._ListInitCmd.Add(":DISP:NORM:ITEM1 U,1\n");
            this._ListInitCmd.Add(":DISP:NORM:ITEM2 I,1\n");
            this._ListInitCmd.Add(":DISP:NORM:ITEM3 P,1\n");

            this._ListInitCmd.Add(":MEAS:AVER:STAT OFF\n");
            this._ListInitCmd.Add(":INP:FILT:FREQ ON\n");
            //this._ListInitCmd.Add(":INP:FILT:LINE ON\n");
            this._ListInitCmd.Add(":INP:FILT:LINE 5500\n");
            this._ListInitCmd.Add("INP:CURR:RANG 10A\n");
            return base.Init();
        }

        public override double Meas_Volt()
        {
            _dVolt = 0.0;
            _szCmd = ":NUM:NORM:ITEM1 U,1\n";
            this.Write(_szCmd);
            _szCmd = ":NUM:NORM:VALUE? 1\n";
            //szRet = this.Query(szCmd);
            //double.TryParse(szRet, out dVolt);
            return base.Meas_Volt();
        }

        public override double Meas_Curr()
        {
            _dCurr = 0.0;
            _szCmd = ":NUM:NORM:ITEM1 I,1\n";
            this.Write(_szCmd);
            _szCmd = ":NUM:NORM:VALUE? 1\n";
            //szRet = this.Query(szCmd);
            //double.TryParse(szRet, out dCurr);
            return base.Meas_Curr();
        }

        public override double Meas_Power()
        {
            _szCmd = ":NUM:NORM:ITEM1 P,1\n";
            this.Write(_szCmd);
            _szCmd = ":NUM:NORM:VALUE? 1\n";
            //szRet = this.Query(szCmd);
            //double.TryParse(szRet, out dPow);
            return base.Meas_Power();
        }
    }
}
